sc.component
Functions for finding out which component types the computer can detect. Use them together with sc.getComponents and sc.getAllComponents.
Functions
getComponentTypes
sc.component.getComponentTypes()
Gets the names of all component types that computers can detect. This includes component types added by addons.
Internal component types that are hidden from computers (like registers and antennas) are not included.
Returns:
- [ string[] ] A list of all component type names, e.g.
"Displays". The order is not guaranteed.
Example:
for _, componentType in ipairs(sc.component.getComponentTypes()) do
local components = sc.getComponents(componentType)
print(componentType .. ": " .. #components)
end
Built-in component types
These are the component types that come with ScrapComputers. Any of them can be passed to sc.getComponents.
| Component type | Shortcut function |
|---|---|
Displays | sc.getDisplays() |
Harddrives | sc.getDrives() |
Holograms | sc.getHolograms() |
Terminals | sc.getTerminals() |
Radars | sc.getRadars() |
NetworkPorts | sc.getNetworkPorts() |
Cameras | sc.getCameras() |
Speakers | sc.getSpeakers() |
Keyboards | sc.getKeyboards() |
Motors | sc.getMotors() |
Lasers | sc.getLasers() |
GPSs | sc.getGPSs() |
SeatControllers | sc.getSeatControllers() |
Lights | sc.getLights() |
GravityControllers | sc.getGravityControllers() |
RadarWarningReceivers | sc.getRadarWarningReceivers() |
CollisionDetectors | sc.getCollisionDetectors() |
PowerComponents | sc.getPowerSources() |
Note:
The power source type is named PowerComponents, not PowerSources.